package com.example.demodb.service;

import com.example.demodb.entity.UserSong;
import com.example.demodb.repository.IUserSongRepository;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserSongService { //service可以抽象成接口
    @Resource
    private IUserSongRepository userSongRepository;
    public void update(UserSong userSong){
        userSongRepository.save(userSong);//覆盖
    }
    public void delete(Long id){
         userSongRepository.deleteById(id);
    }
    public List<UserSong> findAll(){
        return userSongRepository.findAll();
    }
    public UserSong add(UserSong userSong){
        return userSongRepository.save(userSong);
    }

}
